//
//  TrickRegisterVC.swift
//  ANOA
//
//  Created by 邱仙凯 on 2020/1/14.
//  Copyright © 2020 zwb. All rights reserved.
//

import UIKit
import SVProgressHUD
 class TrickRegisterVC: GlobalFormVC {
    
 
     var item3 :KSFormHItem = {
         let appe = KSFormHAppear()
           let v = KSFormHItem(title: "邮箱*",appearance:appe )
         return v
     }()
 
     lazy var registerButton: KSUIButton = {
         let button = KSUIButton(titlex: "注册")
          return button
     }()
   
     var unitid = ""
     var unitNm = ""
     var nameV = ""
     var pwdV = ""
     var phoneV = ""
     var c_dept_name = ""
    override func viewDidLoad() {
        super.viewDidLoad()
        
  
        self.title = "注册"
        self.configRow()
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "取消", style: .done, target: self, action: #selector(dismiss_a))
       
        
        
    }
    func configView() {
          submitButton.setRoundType(roundType: .bottom)
     
            bg
            .add(item3)
       
             bg.add(registerButton)
         
        header.ks_height = bg.frame.maxY + 10
    }
    func configAction() {
        registerButton.button.addTouchUpInSideAction { _ in
            self.saveAction()
        }
        
     
        item3.textValueChangeClo = { str in
            self.phoneV = str
        }
    
  
         
    }
    func configDataSource() {
        
  
        item3.setVal(self.phoneV)
       

    }
 
     
     
    @objc func dismiss_a() {
        self.dismiss(animated: true, completion: nil)
        
    }
    func configRow () {
         
        
        self.configView()
        self.configAction()
        self.configDataSource()
 
      
    }
    
    // MARK: - 提交
    func saveAction() {
         
        
        let vli = self.phoneV.valiRagular(RegularType.mail_pattern)
        guard vli else {
            KSToast("请输入正确邮箱注册")
            return
        }
        SVProgressHUD.show()
        DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {
            SVProgressHUD.dismiss()
            KSToast("注册申请已提交，请稍后留意邮件信息",duration: 2)
            self.dismiss_a()
         }
       
       
        
    }
    
    
    
}

 
